{extend name="adminblue/base" /}
{block name="resources"/}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
<style>
.ns-main{margin-top:0px;}
</style>
{/block}
{block name="main"}
<table class="mytable">
	<tr>
		<td width="10%">
			<span>发生时间：</span>
			<input type="text" id='startDate' placeholder="请选择开始日期" class="input-medium input-common middle" onclick="WdatePicker()"/>
			&nbsp;-&nbsp;
			<input type="text" id='endDate' placeholder="请选择结束日期" class="input-medium input-common middle" onclick="WdatePicker()" />
			<!-- 更多搜索按钮 -->
			<button class="btn-common-white more-search"><i class="fa fa-chevron-down"></i></button>
			<button type="button" onclick="searchData()" value="搜索" class="btn-common">搜索</button>
			<!-- 更多搜索下拉框 -->
			<div class="more-search-container">
				<dl>
					<dt>会员昵称：</dt>
					<dd>
						<input type="text" id='search_text' placeholder="请输入会员昵称" class="input-common  middle" />
					</dd>
				</dl>
				<dl>
					<dt>发生类别：</dt>
					<dd>
						<select id="form_type" class="select-common middle">
							<option value="">全部</option>
							{volist name="from_type_list" id="val"}
							<option value="{$val.type_id}">{$val.type_name}</option>
							{/volist}
						</select>
					</dd>
				</dl>
				<dl>
					<dt></dt>
					<dd><button onclick="searchData()" class="btn-common">搜索</button></dd>
				</dl>
			</div>
		</td>
	</tr>
</table>
<table class="table-class">
	<colgroup>
		<col style="width: 2%;">
		<col style="width: 15%;">
		<col style="width: 20%;">
		<col style="width: 32%;">
		<col style="width: 15%;">
		<col style="width: 16%;">
	</colgroup>
	<thead>
		<tr align="left">
			<th align="center"><i class="checkbox-common"><input type="checkbox" onclick="CheckAll(this)"></i></th>
			<th>会员昵称</th>
			<th>类别</th>
			<th>描述</th>
			<th align="right">金额<span class="row-30"></th>
			<th align="center">时间</th>
		</tr>
	</thead>
	<tbody></tbody>
</table>

{/block}
{block name="script"}
<script type="text/javascript">
function LoadingInfo(page_index) {
	var search_text = $("#search_text").val();
	var start_date = $("#startDate").val();
	var form_type = $("#form_type").val();
	var end_date = $("#endDate").val();
	$.ajax({
		type : "post",
		url : "{:__url('ADMIN_MAIN/member/accountlist')}",
		data : { "page_index" : page_index, "page_size" : $("#showNumber").val(), "search_text":search_text, "form_type":form_type, "start_date":start_date, "end_date":end_date },
		success : function(data) {
			if (data["data"].length > 0) {
				$(".table-class tbody").empty();
				for (var i = 0; i < data["data"].length; i++) {
					var html = '';
					html += '<tr align="left">';
					html += '<td  style="text-align: center;"><i class="checkbox-common"><input name="sub" type="checkbox" value="'+ data["data"][i]["id"]+'" ></i></td>';
					if(data["data"][i]["nick_name"]==null){
						html += '<td>--</td>';
					}else{
						html += '<td>'+ data["data"][i]["nick_name"] +'</td>';
					}
					html += '<td>'+data["data"][i]["type_name"]+'</td>';
					html += '<td>'+ data["data"][i]["text"];
					if(data["data"][i]["data_content"] != undefined && data["data"][i]["data_content"]["order_no"].length > 0){
						html += '【订单号：<a href="'+__URL('ADMIN_MAIN/order/orderdetail?order_id='+data["data"][i]["data_content"]["order_id"])+'">'+data["data"][i]["data_content"]["order_no"]+'</a>】';
					}
					html += '</td>';
					html += '<td align="right">'+ data["data"][i]["number"] +'<span class="row-30"></td>';
					html += '<td align="center">'+ timeStampTurnTime(data["data"][i]["create_time"]) +'</td>';
					html += '</tr>';
					$(".table-class tbody").append(html);
				}
			} else {
				var html = '<tr align="center"><td colspan="9">暂无符合条件的数据记录</td></tr>';
				$(".table-class tbody").html(html);
			}
			initPageData(data["page_count"],data['data'].length,data['total_count']);
			$("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow}));
		}
	});
}

function searchData(){
	LoadingInfo(1);
}

function CheckAll(event){
	var checked = event.checked;
	$("#productTbody input[type = 'checkbox']").prop("checked",checked);
	if(checked) $(".table-class tbody input[type = 'checkbox']").parent().addClass("selected");
	else $(".table-class tbody input[type = 'checkbox']").parent().removeClass("selected");
}

//点击显示更多搜索
$(".more-search").click(function(){
	$(".more-search-container").slideToggle();
})
</script>
{/block}